<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('sup_form')" />
</head>
<body class="white-bg">
	<div class="main-content">
		<form class="form-horizontal" id="form">
			<input id="pageFlag" name="pageFlag" type="hidden" th:value="${rule.pageFlag}" />
			<input id="id" name="id" type="hidden" th:value="${rule.id}" />
			<input id="khz" name="khz" type="hidden" th:value="${rule.khz}" />
			<input id="type" name="type" type="hidden" th:value="${rule.type}" />
			<div class="form-group">
				<label class="col-sm-3 control-label">考核类别：</label>
				<div class="col-sm-8">
					<input name="lb" id="lb" th:value="${rule.lb}" class="form-control" type="text" />
				</div>
			</div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">考核部门：</label>
                <div class="col-sm-8">
                    <select id="dept.deptId" name="dept.deptId" class="form-control m-b" required>
                        <option value="">请选择</option>
                        <option th:each="dept : ${deptList}" th:text="${dept.deptName}" th:value="${dept.deptId}"
                            th:selected="${rule.dept.deptId == dept.deptId}" />
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">考核项目：</label>
                <div class="col-sm-8">
                    <textarea class="form-control" name="xm" id="xm"
                        th:text="${rule.xm}" rows="3" maxlength="1024" required></textarea>
                </div>
            </div>
            <div class="form-group">
				<label class="col-sm-3 control-label is-required">考核序号：</label>
				<div class="col-sm-8">
					<input name="xh" id="xh" th:value="${rule.xh}" class="form-control" type="text" required />
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">考核分值：</label>
				<div class="col-sm-8">
					<input name="fz" id="fz" th:value="${rule.fz}" class="form-control" type="text" required />
				</div>
			</div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">考核内容及标准：</label>
                <div class="col-sm-8">
                    <textarea class="form-control" name="nr" id="nr"
                        th:text="${rule.nr}" rows="3" maxlength="1024" required></textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">考核方式：</label>
                <div class="col-sm-8">
                    <textarea class="form-control" name="fs" id="fs"
                        th:text="${rule.fs}" rows="3" maxlength="256" required></textarea>
                </div>
            </div>
		</form>
	</div>
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: datetimepicker-css" />
	<th:block th:include="include :: datetimepicker-js" />
	<script>
		var prefix = ctx + "rate/rule";
		var pageFlag = '[[${rule.pageFlag}]]';
		
		$(function() {
			if ("ADD" == pageFlag || "EDIT" == pageFlag) {
			} else if ("VIEW" == pageFlag) {
				$("#form input[type='text']").prop("disabled", true);
				$("#form textarea").prop("disabled", true);
				$("#form select").prop("disabled", true);
			}
		});
		
		function submitHandler() {
			if (pageFlag == "ADD" || pageFlag == "EDIT") {
				if ($.validate.form()) {
					$.modal.confirm("确定保存数据？", function() {
						$.operate.save(prefix + "/save", $('#form').serialize());
					});
				}
			} else {
				var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
				parent.layer.close(index); //再执行关闭
				return true;
			}
		}
	</script>
</body>
</html>
